// 实现选项卡功能
function init() {
  // TODO 待补充代码
  const tabs = [...document.querySelectorAll(".tabs div")]
  const content = [...document.querySelectorAll("#content div")]

  const clear = () => {
    for (let i in tabs) {
      tabs[i].classList.remove("active")
      content[i].classList.remove("active")
    }
  }

  for (let index in tabs) {
    tabs[index].addEventListener(
      "click",
      () => {
        clear()
        tabs[index].classList.add("active")
        content[index].classList.add("active")
      },
      false
    )
  }
}
init()
